<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Console extends CI_controller {

	public function __construct(){
		parent::__construct();
	}

	public function index(){
        // die();
		$data = array();
		if($this->session->userdata('user') !== false) {
			$data['user'] = json_encode($this->session->userdata('user'));
		}
		$this->load->view('zm/console',$data);
	}

    private function _ShowType4Html($arr){
        $result = array();
        foreach ($arr as $k => $v) {
            $result[] = $k.'=>'.$v;
        }
        return $result;
    }

	public function getApis() {
        // die();
        global $g_honda_card_type,$g_honda_reservation_type,$g_bluemember_gift,$g_hd_holiday_gift_type
			,$g_hd_invitation_gift_type;
		$apis = array(
			array(
			    'url' => 'api_hd_invitation/initCustomer',
			    'title' => '广汽本田邀请函-初始化用户',
			    'group_name' => '广汽本田',
			    'params' => array(
			        array('name' => 'source','value' => 'haha'),
			        array('name' => 'type','value' => '1'),
			        array('name' => 'openid','value' => 'aaa'),
			        array('name' => 'openid_md5','value' => 'e1d8f1c4ce60cefd8a1ccbafddbbb0af'),
			        array('name' => 'nickname','value' => '小明'),
			        array('name' => 'sex','value' => '1'),
			        array('name' => 'province','value' => '北京'),
			        array('name' => 'city','value' => '北京'),
			        array('name' => 'country','value' => 'CN'),
			        array('name' => 'headimgurl','value' => 'http://www.relonline.cn/resource/relonline$1/logo.jpg'),
			    ),
			    'remark' => '初始化用户数据;微信字段;返回customer; history: 抽奖历史;',
			),
			array(
			    'url' => 'api_hd_invitation/getCode',
			    'title' => '广汽本田-获取卡券',
			    'group_name' => '广汽本田',
			    'params' => array(
			        array('name' => 'source','value' => 'haha'),
							array('name' => 'type','value' => '1'),
			        array('name' => 'hack','value' => '','optional' => true),
			    ),
			    'remark' => '卡券类型'.json_encode($g_hd_invitation_gift_type,JSON_UNESCAPED_UNICODE).';返回卡券信息,同一个类型,返回同一个卡券',
			),

			array(
                'url' => 'api_hd_survey/initCustomer',
                'title' => '广汽本田调查问卷-初始化用户',
                'group_name' => '广汽本田',
                'params' => array(
                    array('name' => 'openid','value' => 'aaa'),
                    array('name' => 'openid_md5','value' => 'e1d8f1c4ce60cefd8a1ccbafddbbb0af'),
                    array('name' => 'nickname','value' => '小明'),
                    array('name' => 'sex','value' => '1'),
                    array('name' => 'province','value' => '北京'),
                    array('name' => 'city','value' => '北京'),
                    array('name' => 'country','value' => 'CN'),
					array('name' => 'headimgurl','value' => ''),
                    array('name' => 'create_code','value' => 'AAA'),
                ),
                'remark' => '初始化用户数据;微信字段;返回customer; history: 抽奖历史;',
            ),
            array(
                'url' => 'api_hd_survey/getCode',
                'title' => '广汽本田调查问卷-获取验证码',
                'group_name' => '广汽本田',
                'params' => array(
					array('name' => 'customer_phone','value' => '18618419289'),
                ),
                'remark' => '',
            ),
			array(
                'url' => 'api_hd_survey/bind',
                'title' => '广汽本田调查问卷-绑定',
                'group_name' => '广汽本田',
                'params' => array(
					array('name' => 'customer_phone','value' => '18618419289'),
					array('name' => 'code','value' => ''),
					array('name' => 'customer_car_number','value' => 'asdfghjkl'),
                ),
                'remark' => '',
            ),
			array(
				'url' => 'api_hd_survey/submitSurvey',
				'title' => '广汽本田调查问卷-提交问卷',
				'group_name' => '广汽本田',
				'params' => array(
					array('name' => 'question_1_1','value' => '9'),
					array('name' => 'question_1_2','value' => '9'),
					array('name' => 'question_1_3','value' => '9'),
					array('name' => 'question_2_1','value' => '9'),
					array('name' => 'question_2_2','value' => '9'),
					array('name' => 'question_2_3','value' => '9'),
					array('name' => 'question_3_1','value' => '9'),
					array('name' => 'question_3_2','value' => '9'),
					array('name' => 'question_3_3','value' => '9'),
					array('name' => 'question_3_4','value' => '9'),
					array('name' => 'question_4_1','value' => '9'),
					array('name' => 'question_4_2','value' => '9'),
					array('name' => 'question_4_3','value' => '9'),
					array('name' => 'question_5_1','value' => '9'),
					array('name' => 'question_5_2','value' => '9'),
					array('name' => 'question_5_3','value' => '9'),
				),
				'remark' => '',
			),


			array(
                'url' => 'api_hd_holiday/initCustomer',
                'title' => '广汽本田假期-初始化用户',
                'group_name' => '广汽本田',
                'params' => array(
					array('name' => 'source','value' => 'haha'),
					array('name' => 'type','value' => '1'),
                    array('name' => 'openid','value' => 'aaa'),
                    array('name' => 'openid_md5','value' => 'e1d8f1c4ce60cefd8a1ccbafddbbb0af'),
                    array('name' => 'nickname','value' => '小明'),
                    array('name' => 'sex','value' => '1'),
                    array('name' => 'province','value' => '北京'),
                    array('name' => 'city','value' => '北京'),
                    array('name' => 'country','value' => 'CN'),
                    array('name' => 'headimgurl','value' => 'http://www.relonline.cn/resource/relonline$1/logo.jpg'),
                ),
                'remark' => '初始化用户数据;微信字段;返回customer; history: 抽奖历史;',
            ),
            array(
                'url' => 'api_hd_holiday/getCode',
                'title' => '广汽本田-获取卡券',
                'group_name' => '广汽本田',
                'params' => array(
					array('name' => 'source','value' => 'haha'),
					array('name' => 'type','value' => '1'),
                ),
                'remark' => '卡券类型'.json_encode($g_hd_holiday_gift_type,JSON_UNESCAPED_UNICODE).';返回卡券信息,同一个类型,返回同一个卡券',
            ),

            array(
                'url' => 'api_hb_bluemember/initCustomer',
                'title' => 'Bluemember-初始化用户',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '9802774a-9f07-4a20-bdc4-1d98d364395f'),
                    array('name' => 'bluemember_phone','value' => '18612345678'),
                ),
                'remark' => '初始化用户数据;微信字段;返回customer;',
            ),
            array(
                'url' => 'api_hb_bluemember/drawnLottery',
                'title' => 'Bluemember-抽奖',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '9802774a-9f07-4a20-bdc4-1d98d364395f'),
                ),
                'remark' => '参数：time(耗时),count(道具数量),
                返回: gift_type(奖品): 　'.json_encode($g_bluemember_gift).'; gift_name(奖品名称);
                ',
            ),
            array(
                'url' => 'api_hb_bluemember/submitAddress',
                'title' => 'Bluemember-提交收货地址',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '9802774a-9f07-4a20-bdc4-1d98d364395f'),
                    array('name' => 'customer_name','value' => '收货姓名'),
                    array('name' => 'customer_phone','value' => '18220000000'),
                    array('name' => 'customer_address','value' => '收地址'),
                ),
                'remark' => '
                ',
            ),
            array(
                'url' => 'api_hb_bluemember/getGiftCustomerList',
                'title' => 'Bluemember-获取中奖信息',
                'group_name' => 'Bluemember',
                'params' => array(
                ),
                'remark' => '
                ',
            ),
            array(
                'url' => 'api_hb_bluemember/receiveCard',
                'title' => 'Bluemember-领取卡券',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '9802774a-9f07-4a20-bdc4-1d98d364395f'),
                    array('name' => 'bluemember_phone','value' => '18618419289'),
                    array('name' => 'source','value' => 'xjfw-pc'),
                ),
                'remark' => '
                ',
            ),

            array(
                'url' => 'http://my.hbweixin.twomi.cn/token.php?type=initCustomer',
                'title' => 'Bluemember-初始化用户',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '4ee944bf-9f0c-4ca6-964f-a5137ff883bd'),
                    array('name' => 'bluemember_phone','value' => '18612345678'),
                ),
                'remark' => '初始化用户数据;微信字段;返回customer;',
            ),
            array(
                'url' => 'http://my.hbweixin.twomi.cn/token.php?type=drawnLottery',
                'title' => 'Bluemember-抽奖',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '4ee944bf-9f0c-4ca6-964f-a5137ff883bd'),
                ),
                'remark' => '参数：time(耗时),count(道具数量),
                返回: gift_type(奖品):  gift_name(奖品名称);
                ',
            ),
            array(
                'url' => 'http://my.hbweixin.twomi.cn/token.php?type=submitAddress',
                'title' => 'Bluemember-提交收货地址',
                'group_name' => 'Bluemember',
                'params' => array(
                    array('name' => 'bluemember_user_id','value' => '4ee944bf-9f0c-4ca6-964f-a5137ff883bd'),
                    array('name' => 'customer_name','value' => '收货姓名'),
                    array('name' => 'customer_phone','value' => '18220000000'),
                    array('name' => 'customer_address','value' => '收地址'),
                ),
                'remark' => '
                ',
            ),

            array(
                'url' => 'api_honda/initCustomer',
                'title' => '广汽本田-初始化用户',
                'group_name' => '广汽本田',
                'params' => array(
                    array('name' => 'openid','value' => 'aaa'),
                    array('name' => 'openid_md5','value' => 'e1d8f1c4ce60cefd8a1ccbafddbbb0af'),
                    array('name' => 'nickname','value' => '小明'),
                    array('name' => 'sex','value' => '1'),
                    array('name' => 'province','value' => '北京'),
                    array('name' => 'city','value' => '北京'),
                    array('name' => 'country','value' => 'CN'),
                    array('name' => 'headimgurl','value' => 'http://www.relonline.cn/resource/relonline$1/logo.jpg'),
                ),
                'remark' => '初始化用户数据;微信字段;返回customer;',
            ),
            array(
                'url' => 'api_honda/getCardNumber',
                'title' => '广汽本田-获取卡券',
                'group_name' => '广汽本田',
                'params' => array(
                    array('name' => 'card_type','value' => '1'),
                ),
                'remark' => '卡券类型'.json_encode($g_honda_card_type,JSON_UNESCAPED_UNICODE).';返回卡券信息,同一个类型,返回同一个卡券',
            ),

            array(
                'url' => 'api_honda/drawnLottery',
                'title' => '广汽本田-抽奖',
                'group_name' => '广汽本田',
                'params' => array(
                ),
                'remark' => '',
            ),
            array(
                'url' => 'api_honda/submitReservation',
                'title' => '广汽本田-提交预约',
                'group_name' => '广汽本田',
                'params' => array(
                    array('name' => 'customer_name','value' => '收货姓名','optional' => true),
                    array('name' => 'customer_phone','value' => '18220000000','optional' => true),
                    array('name' => 'shop_code','value' => 'AAA'),
                    array('name' => 'customer_reservation_type','value' => '1'),
                ),
                'remark' => 'customer_reservation_type: '.json_encode($g_honda_reservation_type,JSON_UNESCAPED_UNICODE).';shop_code,联动返给你的',
            ),
             array(
                'url' => 'api_honda/submitAddress',
                'title' => '广汽本田-提交收货地址',
                'group_name' => '广汽本田',
                'params' => array(
                    array('name' => 'customer_name','value' => '收货姓名'),
                    array('name' => 'customer_phone','value' => '18220000000'),
                ),
                'remark' => '
                ',
            ),
		);

		$this->response->setSuccess();
		$this->response->setItems($apis);
		$this->response->responseExit();
	}
}
/* End of file console.php */
/* Location: ./application/controllers/console.php */
